package com.aliyun.oss.userController;

import com.aliyun.oss.UserService.SetmealService;
import com.aliyun.oss.pojo.Entity.SetMeal;
import com.aliyun.oss.pojo.Vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/setmeal")
public class SetmealController {
    @Autowired
    SetmealService setmealService;
    @GetMapping("/list")
    @Cacheable(cacheNames = "setmealCache",key = "#categoryId") //key：setmealCache::categoryId
    public ResultVO list(Integer categoryId){
        List<SetMeal> setMealList = setmealService.list(categoryId);
        return ResultVO.success(setMealList);
    }
}
